import React, { Component } from 'react'
import { Link, withRouter } from 'react-router-dom'
import { Button } from 'antd'

let name = 'wxy100'
class Works extends Component {
    handleLink = () => {
        console.log('路由跳转')
        console.log(this)
        this.props.history.push('/my')
    }
    render() {
        console.log('获取姓名：', name)
        console.log(this)
        return (
            <div className='works'>
                <p>这个是 works 组件</p>

                <br />

                <Link to={'/my?name=wxy'}>
                    <Button>跳转传参</Button>
                </Link>
                <br />
                <Button onClick={this.handleLink}>路由跳转不用link</Button>
            </div>
        )
    }
}

export default withRouter(Works)
